import os
import random
import string

def generate_data_file(size_kb: int, filename: str):
    """生成指定大小的数据文件"""
    chunk_size = 1024  # 1KB
    with open(filename, 'w') as f:
        for _ in range(size_kb):
            chunk = ''.join(random.choice(string.ascii_letters + string.digits) 
                          for _ in range(chunk_size))
            f.write(chunk)

def main():
    # 创建数据目录
    os.makedirs('data_files', exist_ok=True)
    
    # 生成不同大小的数据文件
    sizes = [1,10, 100, 1000,10000]  # kb
    for size in sizes:
        filename = f'data_files/data_{size}kb.txt'
        print(f"生成 {size}kb 数据文件: {filename}")
        generate_data_file(size, filename)

if __name__ == "__main__":
    main() 